package com.qfedu.service.impl;

import com.qfedu.dao.impl.DeveloperDaoImpl;
import com.qfedu.dao.impl.ProjectDaoImpl;
import com.qfedu.model.Developer;
import com.qfedu.service.DeveloperService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class DeveloperServiceImpl implements DeveloperService {
    @Resource
    private DeveloperDaoImpl developerdaoImpl;
    @Resource
    private ProjectDaoImpl projectDaoImpl;

    //查询所有
    @Override
    public List<Developer> selectAll(){
        return developerdaoImpl.selectAll();
    }

    //新增
    @Override
    public void add(Developer developer) {
        System.out.println(developerdaoImpl.add(developer)>0?"新增成功":"新增失败");
    }

    //删除
    @Override
    public void delete(String id) {
        projectDaoImpl.clearDidByDid(id);
        developerdaoImpl.delete(id);
    }
}
